Book Contents

Example: Logical operators

For these examples, tag1 = 5 and tag2 = 7.

(tag1 < tag2) AND (tag1 == 5)

returns a 1 since both statements are true

tag1 && tag2

returns a 1 since both tag1 and tag2 are non-zero (true)

(tag1 > tag2) OR (tag1 == 5)

returns a value of 1 since tag1 = 5 is true

NOT(tag1 < tag2)

tag1 < tag2 is true and would return a 1 but the NOT operator reverses the logical value, so 0 is returned

See also

About expressions

Logical operators in expressions